/*******************************************************************************
 * Copyright (c) 2007 University of Oslo.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:
 *     University of Oslo - initial API and implementation
 *******************************************************************************/

package com.cea.papyrus.diagram.sequence.sedi.editor;

import org.eclipse.gef.EditPartViewer;
import org.eclipse.gef.ui.actions.ActionRegistry;
import org.eclipse.gef.ui.actions.GEFActionConstants;
import org.eclipse.jface.action.IAction;
import org.eclipse.jface.action.IMenuManager;
import org.eclipse.ui.actions.ActionFactory;

import com.cea.papyrus.diagram.sequence.sedi.action.LifelineDecomposeAction;


public class SeDiContextMenuProvider
	extends org.eclipse.gef.ContextMenuProvider
{

private ActionRegistry actionRegistry;

public SeDiContextMenuProvider(EditPartViewer viewer, ActionRegistry registry) {
	super(viewer);
	setActionRegistry(registry);
}


public void buildContextMenu(IMenuManager manager) {
	GEFActionConstants.addStandardActionGroups(manager);

	IAction action;

	action = getActionRegistry().getAction(ActionFactory.DELETE.getId());
	action.setText("Delete");
	if (action.isEnabled())
		manager.appendToGroup(GEFActionConstants.GROUP_EDIT, action);

	action = getActionRegistry().getAction(GEFActionConstants.DIRECT_EDIT);
	action.setText("Rename");
	if (action.isEnabled())
	manager.appendToGroup(GEFActionConstants.GROUP_EDIT, action);
		
	action = getActionRegistry().getAction(LifelineDecomposeAction.ID);
	action.setText("Decompose lifeline");
	if (action.isEnabled())
		manager.appendToGroup(GEFActionConstants.GROUP_EDIT, action);	
	
	/*
	action = getActionRegistry().getAction(ActionFactory.UNDO.getId());
	action.setText("Undo");
	if (action.isEnabled())
		manager.appendToGroup(GEFActionConstants.GROUP_EDIT, action);
	*/

	//action = getActionRegistry().getAction(ActionFactory.SAVE.getId());
	//action.setText("Save");
	//manager.appendToGroup(GEFActionConstants.GROUP_SAVE, action);

}

private ActionRegistry getActionRegistry() {
	return actionRegistry;
}

private void setActionRegistry(ActionRegistry registry) {
	actionRegistry = registry;
}

}